package action;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;
import model.LabTest;
import model.User;
import service.LabTestService;

import java.util.List;
import java.util.Map;

/**
 * Created by IntelliJ IDEA.
 * User: TM
 * Date: 11/19/12
 * Time: 10:15 PM
 * To change this template use File | Settings | File Templates.
 */
public class LabTestAction extends ActionSupport implements ModelDriven {

    private LabTestService labTestService;
    private List<LabTest> labTestList;
    private String invoiceNo;
    private String profile;

    public String labTest() {
        ActionContext ctx = ActionContext.getContext();
        Map session = ctx.getSession();
        User user = (User) session.get("USER");
        labTestList = labTestService.viewLabTestList(user);
        return "viewLabTest";
    }

    public String labTestResultResult() {
           ActionContext ctx = ActionContext.getContext();
           Map session = ctx.getSession();
           User user = (User) session.get("USER");
           LabTest labTest = new LabTest();
           labTest.setInvoiceNo(getInvoiceNo());
           labTest.setProfile(getProfile());
           labTestService.viewLabTestResult(user, labTest);
           return "viewLabTestResult";
       }


    public Object getModel() {
        return null;  //To change body of implemented methods use File | Settings | File Templates.
    }

    public LabTestService getLabTestService() {
        return labTestService;
    }

    public void setLabTestService(LabTestService labTestService) {
        this.labTestService = labTestService;
    }

    public List<LabTest> getLabTestList() {
        return labTestList;
    }

    public void setLabTestList(List<LabTest> labTestList) {
        this.labTestList = labTestList;
    }

    public String getInvoiceNo() {
        return invoiceNo;
    }

    public void setInvoiceNo(String invoiceNo) {
        this.invoiceNo = invoiceNo;
    }

    public String getProfile() {
        return profile;
    }

    public void setProfile(String profile) {
        this.profile = profile;
    }
}
